package com.woorigil.social.domain.member;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;
import org.springframework.stereotype.Repository;

import com.ibatis.sqlmap.client.SqlMapClient;

@Repository
public class MemberDao extends SqlMapClientDaoSupport {
	
	@Autowired
	public void setCouponSqlMapClient(SqlMapClient couponSqlMapClient) {
		this.setSqlMapClient(couponSqlMapClient);
	}

	public int insert(Member member) {
		return (Integer) getSqlMapClientTemplate().insert("Member.insert", member);
	}
	
	public int update(Member member) {
		return (Integer) getSqlMapClientTemplate().update("Member.update", member);
	}
	
	public int delete(int seq) {
		return (Integer) getSqlMapClientTemplate().delete("Member.delete", seq);
	}
	
	public int deleteById(String id) {
		return (Integer) getSqlMapClientTemplate().delete("Member.deleteById", id);
	}
	
	public Member select(int seq) {
		return (Member) getSqlMapClientTemplate().queryForObject("Member.select", seq);
	}
	
	public Member selectById(String id) {
		return (Member) getSqlMapClientTemplate().queryForObject("Member.selectById", id);
	}
	
	@SuppressWarnings("unchecked")
	public List<Member> selectList() {
		return getSqlMapClientTemplate().queryForList("Member.selectList");
	}
}	

